package Homework.Top1.Test3;

import java.util.*;

public class ArryList {
    public static void main(String[] args) {
        List a=new ArrayList();
        List b=new LinkedList();
        long start=System.nanoTime();
        for (int i=0;i<=100000;i++){
            a.add(i);
        }
        long end=System.nanoTime();
        System.out.println("ArrayList生成"+(end-start));
        System.out.println("\n\n");
        long start1=System.nanoTime();
        for (int j=0;j<=100000;j++){
            b.add(j);
        }
        long end1=System.nanoTime();
        System.out.println("LinkedList生成"+(end1-start1));
        System.out.println("\n\n");
        long start2=System.nanoTime();
        for (int i=0;i<=100;i++){
            a.remove(i);
        }
        long end2=System.nanoTime();
        System.out.println("ArrayList删除"+(end2-start2));
        System.out.println("\n\n");
        long start3=System.nanoTime();
        for (int i=0;i<=100;i++){
            b.remove(i);
        }
        long end3=System.nanoTime();
        System.out.println("LinkedList删除"+(end3-start3));
    }

}
